<%@ page language="java" contentType="text/html; charset=windows-1255"
	pageEncoding="windows-1255"%>
<!DOCTYPE html>

<%
    String contentFrame = "register.jsp";
	if (null != request.getParameter("logout"))
	{
		session.invalidate();
		response.sendRedirect("index.jsp");
		return;
	}
	else if (null != request.getParameter("page"))
	{
		contentFrame = request.getParameter("page");
    }
        
	else if (null != cs236369.hw5.util.HTMLFilter.filter(request.getRemoteUser()))
	{
		response.sendRedirect("index.jsp?page=\"crowd/search.jsp\"");
		return;
	}  
%>
<html>
<head>
    <title>CrowdSourcing - sourcing people</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    
    <link rel="icon" href="images/crowdSourcingLogo.png" type="image/x-icon" />
    <link rel="stylesheet" type="text/css" title="index_css" href="/${project.build.finalName}/css/index.css" />
</head>
<body>

    <img id="header" src="images/header.png" alt="Crowd Sourcing"/>
    
    <br/>
    <table id="menu">
        <tr>
            <td>
                <a href='index.jsp?page="about.jsp"'>        
                    <img src='/${project.build.finalName}/images/search-out.png' alt='About'/>
                </a> 
            </td>        
            <%
            if (null == cs236369.hw5.util.HTMLFilter.filter(request.getRemoteUser()))
            {
            %>
                <td> 
                    <a href="crowd/login.jsp"> 
                        <img src='images/index-over.png' alt='login'/>    
                    </a>
                </td>
                <td> 
                    <a href='index.jsp?page="register.jsp"'> 
                        <img src='images/index-over.png' alt='register'/>    
                    </a>
                </td>
                
            <% 
            }
            else
            {
            %>
                <td>
                    <a href='index.jsp?page="crowd/userInfo.jsp"'>
                        <%= cs236369.hw5.util.HTMLFilter.filter(request.getUserPrincipal().getName()) %>
                    </a> 
                </td>
                <td>
                    <a href='index.jsp?page="crowd/message.jsp"'>
                        <img src='/${project.build.finalName}/images/index-over.png' alt='New Message'/>
                    </a>
                </td>
                <td>
                    <a href='index.jsp?page="crowd/event.jsp"'>
                        <img src='/${project.build.finalName}/images/browse-out.png' alt='Create Event'/>
                    </a>
                </td> 
                <td>
                    <a href='index.jsp?page="crowd/search.jsp"'>
                        <img src='/${project.build.finalName}/images/search-out.png' alt='Search'/>
                    </a> 
                    
                </td>
                <td>
                    <a href='index.jsp?page="crowd/yellowPages.jsp"'>
                        <img src='/${project.build.finalName}/images/room-out.png' alt='Yellow-Pages'/>
                    </a> 
                </td>
                <%
                if (request.isUserInRole("admin"))
                {%>
                    <td> 
                        <a href='index.jsp?page="crowd/admin.jsp"'>
                            <img src='/${project.build.finalName}/images/search-out.png' alt='Admin'/>
                        </a>
                    </td>
                <% } %>
                <td> 
                    <a href='index.jsp?logout'> 
                        <img src='/${project.build.finalName}/images/search-out.png' alt='Log Out'/>
                    </a>
                </td>
            <% } %>            
        </tr>
            
    </table>
    <br/>
    <p align="center">
    	<iframe id="content_frame" src=<%= contentFrame %> width="95%" height=520></iframe>
   	</p>
   	<div id="footer" class="center">
       	<a href="mailto:somemail@t2.admin.ac.il">Contact us</a>
    </div> 
   
    
    
    
     
</body>
</html>
